<template>
	<view>
		<view class="btn_box">
			<view class="button" v-for="(item,i) in getDoglicking" @click="getDoglickingDiarys(item)">
				<text :class="'bg-'+themeColor.name">{{item.name}}</text>
			</view>
			<view class="button" @click="Getzuan()">
				<text :class="'bg-'+themeColor.name">祖安宝典</text>
			</view>
			<view class="button" @click="HuanYiPi()">
				<text :class="'bg-'+themeColor.name">换一批</text>
			</view>
			<!-- Getzuan -->
			<video v-if="IsVideos" src="https://www.nihaowua.com/v/video.php" controls></video>
		</view>
		
		<view class="tiangouCon_box">
			{{tiangouCon}}
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tiangouCon:"",
				IsVideos:true,
				getDoglicking:[
					{//舔狗日记
						id:1,
						name:"舔狗日记",
						typeId: "0c97d296-e5b1-11ea-9d4b-00163e1e93a5"
					},
					{//打工人笔记
						id:2,
						name:"打工人笔记",
						typeId: "cbb26a26-14df-11eb-9d4b-00163e1e93a5"
					},
					{//撩妹宝典
						id:3,
						name:"撩妹宝典",
						typeId: "485eee9c-e603-11ea-9d4b-00163e1e93a5"
					},
					{//文艺句子
						id:4,
						name:"文艺句子",
						typeId: "7d12b115-ed92-11ea-9d4b-00163e1e93a5"
					},
					{//毒鸡汤
						id:5,
						name:"毒鸡汤",
						typeId:"b1386080-e5b7-11ea-9d4b-00163e1e93a5"
					},
					{//网抑云
						id:6,
						name:"网抑云",
						typeId:"f67a73f4-e5b7-11ea-9d4b-00163e1e93a5"
					},
					{//动漫语录
						id:7,
						name:"动漫语录",
						typeId:"0760fbcd-e5b8-11ea-9d4b-00163e1e93a5"
					},
					{//土味情话
						id:8,
						name:"土味情话",
						typeId:"b40bc82d-e5b7-11ea-9d4b-00163e1e93a5"
					},
					{//名人名言
						id:9,
						name:"名人名言",
						typeId:"bb11e9b0-e5b7-11ea-9d4b-00163e1e93a5"
					},
					{//诗词名句
						id:10,
						name:"诗词名句",
						typeId:"c4c2abc1-e5b7-11ea-9d4b-00163e1e93a5"
					}
				]	
			}
		},
		onLoad() {
			let idx = this.$util.random(0,9)			
			this.getDoglickingDiarys(this.getDoglicking[idx])
		},
		//https://www.nihaowua.com/v/video.php?_t=0.017976383956399777
		methods:{
			HuanYiPi(){
				this.IsVideos = false
				let idx = this.$util.random(0,9)
				this.getDoglickingDiarys(this.getDoglicking[idx])
				setTimeout(()=>{
					this.IsVideos = true
				},100)
			},
			Getzuan(){
				let that = this
				that.$api.Getzuan().then((res)=>{
					let datas = res.data
					that.tiangouCon = datas
				})
			},
			getDoglickingDiarys(item){
				let that = this
				let data  = {typeId:item.typeId}
				
				that.$api.getDoglickingDiary(data).then((res)=>{
					let datas = res.data
					if(datas.code == 0){
						that.tiangouCon = datas.data
					}
				})
			},
			

			
	
			
			
			
		}		
	}
</script>

<style lang="less" scoped>
	.btn_box{
		display: flex;
		align-items: center;
		justify-content: center;
		flex-wrap: wrap;
	}
	.button{
		width: 50%;
		padding: 20rpx;
		box-sizing: border-box;
	}
	button:hover{opacity: 0.8;}
	.button text{
	
		border-radius: 20rpx;
		height: 70rpx;
		line-height:  70rpx;
		width: 100%;
		display: block;
		text-align: center;
	}
	.button:nth-child(even) text{
		background-color: #4CD964;
	}
	.tiangouCon_box{
		margin: 20rpx;
		background-color: #CBEED4;
		padding: 20rpx;
		box-sizing: border-box;
		line-height: 48rpx;
		text-indent: 2em;
	}
</style>
